/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package homework6;

/**
 *
 * @author Administrator
 */
import java.util.*;
public class MainH{
    public static void main(String []args){
        Scanner reader = new Scanner(System.in);
        String str1;
        int m=0,n=0;
        str1 = reader.next();
        while(str1.indexOf("guangming", m)>=0){
            m=str1.indexOf("guangming", m)+1;
            n++;
        }
        System.out.println(n);
    }
}
